/* License Notice:
 *
 * This program is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *   GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 *   along with this program. If not, see <https://www.gnu.org/licenses/>.
 */

/**
 * @file demo_level.hpp
 * @author TooOld2Rock'nRoll
 * @date 2023/10/03
 * @brief A example level for the ArcadeFighter Library.
 *
 * @todo - substitute ground level for "solid blocks" when we have impact detection implemented.
 * @bug player sprite seams on the wrong state when rendering starts.
 * @bug loading screen delta_t is being processed wrong, change regime of loop to test!
 */
#ifndef _DEMO_LEVEL_HPP_
#define _DEMO_LEVEL_HPP_

/*---- Includes ----*/
#include "graphics/font.hpp"
#include "graphics/sprite2D.hpp"
#include "graphics/text_box.hpp"
#include "level.hpp"

#include "demo_level_background.hpp"


/*---- Class Declaration ----*/
/**
 * @brief A example of how a level could be implemented extending the Level class.
 * @extends Level
 */
class DemoLevel : public Level
{
    private:
        const unsigned ui_ground_lvl = 0; ///< line in which the players walk and normally wouldn't fall under.

        Sprite2D _loading_animation;
        DemoLevelBackground *background = nullptr;

        Font *font_managore = nullptr;
        TextBox sp_textbox;

        Audio::MusicFile *soundtrack = nullptr;
        Audio::Effect *p_char_walk_step = nullptr;
        Audio::Effect *p_char_run_step = nullptr;
        Audio::Effect *p_char_land = nullptr;

        void _loadResourcesThread_cb ();
        void _joinThread ();
        void _updateCameraPosition ();


    protected:


    public:
        DemoLevel ();
        ~DemoLevel ();

        bool setState (level_state_e new_state) override;

        void load () override;

        static void highPriorityEvents_cb (DemoLevel *obj_this, const EventManager::event_s &ev);
        void processEvents (double delta_t) override;
        void update (double delta_t) override;
        void draw (double delta_t) override;
};//END DemoLevel

#endif //_DEMO_LEVEL_HPP_

